package cn.jdy.plugins.web.gajjb;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import cn.jdy.common.ctrl.BaseCtrl;
import cn.jdy.framework.log.BaseLog;
import cn.jdy.plugins.entity.NewsXysgajM;
import cn.jdy.plugins.service.xysgajM.NewsXysgajMService;

/**
 * @desc    襄阳市公安举报系统-法律法规操作
 * @author  ningqian
 * @since   2016-06-23
 */

@Controller
@RequestMapping("/newXysgajM")
public class NewsXysgajMCtrl extends BaseCtrl{
	@Autowired
	private NewsXysgajMService newsXysgajMService;
	
	 @RequestMapping("")
	  public ModelAndView list(NewsXysgajM newsxysgajm){
	    ModelAndView mv = new ModelAndView("/index.jsp");
	    newsxysgajm.setStatus("1");// 状态 0：无效/未审核，1：有效/审核通过/未复签，2：审核不过, 3: 置顶（每一分类仅一条消息能被置顶），4：已复签
	    mv.addObject("dataList", newsXysgajMService.querypagelaws(newsxysgajm));
	    mv.addObject("iTotalDisplayRecords", newsXysgajMService.count(newsxysgajm));
	    mv.addObject("entity", newsxysgajm);
	    mv.addObject("pid",newsxysgajm.getColumnId());
	    return mv;
	  }
	  
	  /**
	   * 异步获取法律法规列表
	   * @param productx
	   * @param key
	   * @param pid
	   * @return
	   */
	  @RequestMapping("/loadMorenNewXysgajM")
	  @ResponseBody
	  public Map<String, Object> loadMore(NewsXysgajM newsxysgajm){
	    Map<String, Object> jsonMap = new HashMap<String, Object>();
	    try {
	    	newsxysgajm.setStatus("1");// 状态 0：无效/未审核，1：有效/审核通过/未复签，2：审核不过, 3: 置顶（每一分类仅一条消息能被置顶），4：已复签
	      jsonMap.put("dataList", newsXysgajMService.querypage(newsxysgajm));
	      jsonMap.put("iTotalDisplayRecords", newsXysgajMService.count(newsxysgajm));
	    } catch(Exception e) {
	      BaseLog.e(this.getClass(), "查询异常", e);
	    }
	    return jsonMap;
	  }
	  
	  /**
	   * 法律法规详情
	   * @param id
	   * @return
	   
	  @RequestMapping("/show-{id}.html")
	  public ModelAndView queryDetail(@PathVariable Long id) {
	    ModelAndView mv = new ModelAndView("/lawsDetail.jsp");
	    mv.addObject("data", id==null||id==0 ? id : this.newsXysgajMService.find(id));
	    return mv;
	  }*/
}
